package com.henu.cee_service.controller;

import com.henu.cee_service.service.FillCEEService;
import com.henu.cee_service.utils.DataResult;
import com.henu.cee_service.utils.SchoolRanking;
import com.henu.cee_service.vo.req.PreferenceReqVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


/**
 * description: FillCeeController
 * date: 2020/9/6 15:35
 * author: JSM
 * version: 1.0
 */
@RestController
@RequestMapping("/v1/fillcee")
@Api(tags="填报志愿相关接口")
public class FillCEEController {

    @Autowired
    private FillCEEService fillCEEService;

    @PostMapping("/getGrade")
    @ApiOperation(value = "分数填报")
    public DataResult gradeInput(@RequestBody PreferenceReqVO vo) {
//        System.out.println(vo);
        DataResult result = DataResult.success(fillCEEService.getGrade(vo));
//        System.out.println(result.getData());
        return result;
    }

    @PostMapping("/selectFillingBatch")
    @ApiOperation(value = "选择批次")
    public DataResult selectFillingBatch(@RequestBody PreferenceReqVO vo) {
        return DataResult.success();
    }

    @PostMapping("/voluntaryForm")
    @ApiOperation(value = "查看推荐志愿")
    public DataResult voluntaryForm(@RequestBody PreferenceReqVO vo) {
        Map<String, String> unversity = SchoolRanking.getSchoolByScore(vo.getScore());
        DataResult result = DataResult.success();
        result.setData(unversity);
        return result;
    }
}
